package com.example.service.impl;

import com.example.entity.Place;
import com.example.mapper.PlaceMapper;
import com.example.service.PlaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author:tjf
 * @Description:
 */
@CacheConfig(cacheNames = "com.example.service.impl.PlaceServiceImpl")
@Service
public class PlaceServiceImpl implements PlaceService {
    @Autowired
    private PlaceMapper placeMapper;

    /**
     * 查询所有生产地的业务方法
     * @return
     */
    @Cacheable(key = "'place:all'")
    @Override
    public List<Place> queryAllPlace() {
        return placeMapper.selectAllPlace();
    }
}
